<?
require_once('./lib/lib.gear.php');

$url   = 'http://api.mixi-platform.com/2/voice/statuses';
//$img = file("./images/b400.jpg");
/*
$file  = fopen("./images/b400.jpg", 'rb');
$img   = fread($file, filesize("./images/b400.jpg"));
fclose($file);
*/

$handle = fopen("./images/b400.jpg", "rb");
$img    = file_get_contents("./images/b400.jpg");


$data = array(
             'status' => 'フォトと一緒に送るよ～！！',
           //  'photo' => $img,
             );

$headers = array(
	"Host: api.mixi-platform.com",
    "Authorization: OAuth ee96a2362d28f1b9ab7bbaf2f3dcdcb95a42bdfb",
	"Content-Length: ".strlen(http_build_query($data)),
	"Content-Type: multipart/form-data; charset=UTF-8",

);

$options = array('http' => array(
    'method' => 'POST',
    'header' => implode("\r\n", $headers),
    'content' => http_build_query($data),
));

$contents = file_get_contents($url, false, stream_context_create($options));

fclose($handle);

preDump('status='.urlencode('フォトと一緒に送るよ～').'&photo='.$img);

//http_build_query($data) 'status='.urlencode('フォトと一緒に送るよ～').'&photo='.$img

?>